Skip to content

Refactor sumOfSeries for precision and user input - #3236

Open
Jaswanth02004 wants to merge 1 commit into
geekcomputers:masterfrom
Jaswanth02004:patch-1
Open

Jaswanth02004 wants to merge 1 commit into
geekcomputers:masterfrom
Jaswanth02004:patch-1

Conversation

@Jaswanth02004

@Jaswanth02004 Jaswanth02004 commented Nov 16, 2026 •

Copy link
Copy Markdown

Updated sumOfSeries function to use integer division for precision and changed input method to prompt user.

Description

Please include a summary of the changes and related context. Explain the problem you're solving or feature you're adding.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code cleanup/refactoring

Related Issues

Closes #(issue number)

Testing

Please describe the tests you've run to verify your changes:

  • Manual testing
  • Added automated tests
  • Existing tests pass

Checklist

  • My code follows the project's code style
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the README.md if needed
  • My changes generate no new warnings
  • I have tested my code locally
  • New and existing tests pass with my changes

Screenshots (if applicable)

Add screenshots or demos of your changes if relevant.

Updated sumOfSeries function to use integer division for precision and changed input method to prompt user.
@Jaswanth02004

Copy link
Copy Markdown
Author

Changes made from the original version:

  1. Replaced float division '/' with integer division '//' to keep exact precision for large numbers.
  2. Removed '(int)' typecasting in the return statement since 'x' is already an integer.
  3. Replaced hardcoded 'n = 2' with 'int(input(...))' to accept dynamic user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant